package com.angel.architecture.services.impl;

import com.angel.architecture.daos.UserDAO;
import com.angel.architecture.dtos.LoginInfoDTO;
import com.angel.architecture.exceptions.BusinessException;
import com.angel.architecture.persistence.beans.User;
import com.angel.architecture.services.LoginService;

/**
 *
 * @author William
 */
public class LoginServiceImpl extends GenericServiceImpl implements LoginService{


    public User login(String userName, String password) {
        UserDAO userDAO = (UserDAO) super.getGenericDAO();
        User user = userDAO.findUniqueOrNullByUserNameAndPassword(userName, password);
        if(user == null){
            throw new BusinessException("User [" + userName + "] doesn't exist.");
        }
        return user;
    }

	public User login(LoginInfoDTO loginInfoDTO) {
		//TODO Do it.
		return null;
	}

	public void logout(LoginInfoDTO loginInfoDTO) {
		//TODO Do it.
	}
}